<?php
session_start();
$openid=NULL;
$_SESSION['code']=rand(1112,9998);
if (isset($_GET['op'])){
    $openid=$_GET['op'];
    $_SESSION['openid']=$openid;
}
if (isset($_SESSION['openid'])){
    $openid=$_SESSION['openid'];
}
if (empty($openid)){
    exit;
}
include_once("./c/config.php");

$userInfo=array();
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
 
$query=$mysqli->query("select id from u3 where openid='".$openid."' limit 0, 1");
$name=$phone=$nianji='';
if($query->num_rows>0){
    $userInfo=$query->fetch_array();
    $query=$mysqli->query("select name,phone,nianji,qu,xuexiao from u3 where openid='".$openid."' limit 0, 1");
    $getInfo=$query->fetch_array();
    $name=$getInfo['name'];
    $phone=$getInfo['phone'];
    $nianji=$getInfo['nianji'];
    $qu=$getInfo['qu'];
    $xuexiao=$getInfo['xuexiao'];
}
//$url='http://lin.mei94.com/finals/';
$url='./';
$urlB='./';
$mysqli->close();
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<title></title>
<style>
html,body{font-size:16px;width:100%;font-size:12px;color:#fff;font-family:Microsoft YaHei, Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;}
body, div{position:relative;padding:0px;margin:0px auto;max-width:750px;}
.weui-dialog{position:fixed;z-index:5000;width:80%;max-width:300px;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#FFF;text-align:center;border-radius:3px;overflow:hidden}.weui-dialog__hd{padding:1.3em 1.6em .5em}.weui-dialog__title{font-weight:400;font-size:18px}.weui-dialog__bd{padding:0 1.6em .8em;min-height:40px;font-size:15px;line-height:1.3;word-wrap:break-word;word-break:break-all;color:#999}.weui-dialog__bd:first-child{padding:1.2em 20px .1em;color:#353535}.weui-dialog__ft{position:relative;line-height:48px;font-size:18px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-dialog__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1px solid #D5D5D6;color:#D5D5D6;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.weui-dialog__btn{display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#3CC51F;text-decoration:none;-webkit-tap-highlight-color:transparent;position:relative}.weui-dialog__btn:active{background-color:#EEE}.weui-dialog__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1px solid #D5D5D6;color:#D5D5D6;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleX(.5);transform:scaleX(.5)}.weui-dialog__btn:first-child:after{display:none}.weui-dialog__btn_default{color:#353535}.weui-dialog__btn_primary{color:#0BB20C}@media screen and (min-width:1024px){.weui-dialog{width:35%}}.weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,.6)}.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}
-webkit-touch-callout:none;
-webkit-user-select:none;
html{-ms-touch-action:none;}
*{-webkit-overflow-scrolling:touch;}
.fixfixed {position:absolute;}
div,img{-webkit-tap-highlight-color:rgba(0,0,0,0);}
*{-webkit-text-size-adjust: none;}
.simg{position:absolute;display:block;}
a{text-decoration:none;}
.txt{position:absolute;text-indent:6px;font-size:12px;z-index:2;}
.txt::-webkit-input-placeholder {color:#b4b4b4;text-align:left;}
.container{position:relative;width:100%;height:auto;overflow:hidden;}
.p1, .qu, .p3, .p2, .p4{position:absolute;width:100%;height:100%;display:none;}
.p1{background:#fbfbfb;} 
input{position:absolute;display:block;text-indent:10px;-webkit-appearance:none;background:none;padding:0;outline-style:none;border:none;color:#000;}
select{position:absolute;display:block;background:transparent;border:0px;text-indent:8px;font-size:12px;-webkit-appearance:none;}
@-webkit-keyframes p1yu{0%{-webkit-transform:translateX(26px) translateY(-50px);opacity:0;}  80% {-webkit-transform:translateX(0px) translateY(0px);opacity:.9;} 100% {-webkit-transform:translateX(0px) translateY(0px);opacity:1;} }
.p1yu{-webkit-animation: p1yu 4s;}
 
.t-rule, .t-zhuyi, .ti{position:absolute;width:100%;z-index:99;top:0px;left:0px;display:none;}
.t-end, .t-wan{position:absolute;width:100%;z-index:9999;top:0px;left:0px;display:none;}
.p-b, .thebg{position:absolute;width:100%;top:0;left:0;} 
#iosDialog2{display:none;}
.p1-top{position:absolute;width:100%;display:block;top:0;left:0;}
.p1-b1{position:absolute;width:100%;display:block;bottom:0;left:0;}
.p1-button{position:absolute;width:100%;left:0;background:transparent url('<?php echo $urlB; ?>/img/p1-b.png?v=3') no-repeat;background-size:cover;} 
.p2-ytxt{position:absolute;text-align:center;font-size:12px;color:#fff;}
.p1-zi{opacity: 0;-webkit-transform: scale(5, 5);-webkit-transition: all 0.8s;-webkit-transform-origin: 50% 50%;}
.hide{display:none;}
.p3-t1{position:absolute;}
.p3-i1{font-size:13px;color:#000;}
.home-top{position:absolute;width:100%;display:block;top:0;left:0;}
.p4-down{position:absolute;width:100%;}
.p4-shi, .p4-fen, .p4-miao{position:absolute;font-size:16px;color:#000;font-weight:700;text-align:right;}
 
</style>
</head>
<body>
<div class="container">
  <div class="p1 page">
     <img class="home-top simg " src="<?php echo $urlB; ?>img/p1-top.jpg">
     <img class="p1-bg simg " src="<?php echo $urlB; ?>img/p1.jpg">
     <img class="home-top simg " src="<?php echo $urlB; ?>img/p1-top2.jpg">
     <div class="thebg">
         <img class="home-top simg " src="<?php echo $urlB; ?>img/p1-zi.png">
         <img class="p1-gui p1-zi simg " src="<?php echo $urlB; ?>img/p1-gui.png">
         <img class="p1-guan p1-zi simg " src="<?php echo $urlB; ?>img/p1-guan.png">
         <img class="p1-sao p1-zi simg " src="<?php echo $urlB; ?>img/p1-sao.png">
         <img class="p1-nian p1-zi simg " src="<?php echo $urlB; ?>img/p1-nian.png">
         <div class="p1-button">
         <div class="p1-bm simg"></div>
         </div>
     </div>
  </div> 

  <div class="qu">
      <img class="bg simg" src="<?php echo $urlB; ?>img/3/bg.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-top.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-b1.png?v=3">
      <img class="p1-b1 simg" src="<?php echo $urlB; ?>img/3/p1-b1.jpg?v=6">
      <div class="thebg">
         <img class="qu-t1 simg" src="<?php echo $urlB; ?>img/3/p1-t1.png">
         <img class="qu-sh qu-shb simg" data-id="sh" src="<?php echo $urlB; ?>img/3/red.png">
         <img class="qu-sh simg" data-id="sh" src="<?php echo $urlB; ?>img/3/sh.png">
         
         <img class="qu-sz qu-szb simg" data-id="sz" src="<?php echo $urlB; ?>img/3/red.png">
         <img class="qu-sz simg" data-id="sz" src="<?php echo $urlB; ?>img/3/sz.png">
          
         <img class="qu-nt qu-ntb simg" data-id="nt" src="<?php echo $urlB; ?>img/3/red.png">
         <img class="qu-nt simg" data-id="nt" src="<?php echo $urlB; ?>img/3/nt.png">
         <div class="qu-jin simg"></div>
      </div>
  </div>
  
  <div class="p2">
      <img class="bg simg" src="<?php echo $urlB; ?>img/3/bg.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-top.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-b1.png?v=3">
      <img class="p1-b1 simg" src="<?php echo $urlB; ?>img/3/p1-b1.jpg?v=6">
      <div class="thebg">
         <img class="p2-t1 simg" src="<?php echo $urlB; ?>img/3/p2-t1.png">
         <input id="p2-name" class="txt" name="name" value="" placeholder="请填写学生姓名"  />
         <select id="p2-nianji" name="nianji">
				<option value="">选择年级</option>
				<?php 
				   $nianjiData=array('三年级','四年级','五年级','六年级');
				   foreach ($nianjiData as $value){
				?>
				<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
				<?php } ?>
	     </select>
         <input id="p2-phone" class="txt" name="phone" type="number" value="" placeholder="请填写初赛预留的手机"  />
         <input id="p2-code" class="txt" name="code" type="number" value=""  />
         
         <img class="p2-t2 simg" src="<?php echo $urlB; ?>img/3/p2-t2.png">
         <img class="p2-yz simg" src="<?php echo $urlB; ?>img/3/p2-yz.png">
         <div class="p2-ytxt hide">30s</div>
         <div class="p2-send simg"></div>
         
         <div class="p2-jin simg"></div>
      </div>
  
  </div>
  
  <div class="p3">
      <img class="bg simg" src="<?php echo $urlB; ?>img/3/bg.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-top.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-b1.png?v=3">
      <img class="p1-b1 simg" src="<?php echo $urlB; ?>img/3/p1-b1.jpg?v=6">
      <div class="thebg">
         <img class="p3-t2 simg" src="<?php echo $urlB; ?>img/3/p3-t1.png">
         <div class="p3-t1">
            <div class="p3-i1">姓名：<span class="p3-iname"><?php echo $name; ?></span></div>
            <div class="p3-i1">手机：<span class="p3-iphone"><?php echo $phone; ?></span></div>
            <div class="p3-i1">年级：<span class="p3-inj"><?php echo $nianji; ?></span></div>
            <div class="p3-i1">地区：<span class="p3-iqu"><?php echo $qu; ?></span></div>
            <div class="p3-i1">学校：<span class="p3-ixue"><?php echo $xuexiao; ?></span></div>
         </div>
         <div class="p3-quren simg"></div>
      
      </div>
  
  </div>
  
  <div class="p4">
      <img class="bg simg" src="<?php echo $urlB; ?>img/3/bg.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-top.jpg">
      <img class="p1-top simg" src="<?php echo $urlB; ?>img/3/p1-b1.png?v=3">
      <img class="p1-b1 simg" src="<?php echo $urlB; ?>img/3/p1-b1.jpg?v=6"> 
      <div class="thebg">
          <img class="p4-t1 simg" src="<?php echo $urlB; ?>img/3/p4-t1.png">
          <div class="p4-down">
             <div class="p4-shi">00 时</div>
             <div class="p4-fen">14 分</div>
             <div class="p4-miao">59 秒</div>
          </div>
      
      </div>
  
  </div>
 
   
  <div class="js_dialog" id="iosDialog2" style="opacity: 1;">
       <div class="weui-mask"></div>
       <div class="weui-dialog">
                <div class="weui-dialog__bd weui-msg"></div>
                <div class="weui-dialog__ft">
                    <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary weui-btn">知道了</a>
                </div>
        </div>
 </div>
  
</div>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="<?php echo $url; ?>/js/pxloader-images.min.js"></script>
<script src="<?php echo $url; ?>/js/jquery.countdown.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>750){sWidth=750;}
var _rate=(sWidth/750);
if(h<_rate*1206){
	h=_rate*1206;
}
var _img=['p1-top.jpg'];
var loader = new PxLoader();
for(var i=0; i<_img.length; i++){loader.addImage('<?php echo $urlB; ?>/img/'+_img[i]);}

function setShow(time, id, docall) {
    setTimeout(function () {
        document.querySelector(id).style.display = "block";
        setTimeout(function () {
            if (docall) {
                docall(document.querySelector(id));
            } else {
                document.querySelector(id).style["-webkit-transform"] = "scale(1,1)";
            }
        }, 100);
    }, time);
}

loader.start();
loader.addCompletionListener(function(e) {
   <?php if (!empty($name)){ ?>
     $(".p3").show();
   <?php }else{ ?>
     $(".p1").show();
     var time = 400;
     window.setTimeout(function(){
    	 setShow(0, ".p1-gui", function (dom) {
             dom.style.opacity = 1;
             dom.style["-webkit-transform"] = "scale(1,1)";
         });
         setShow(time, ".p1-guan", function (dom) {
             dom.style.opacity = 1;
             dom.style["-webkit-transform"] = "scale(1,1)";
         });
     
         setShow(time + time, ".p1-sao", function (dom) {
             dom.style.opacity = 1;
             dom.style["-webkit-transform"] = "scale(1,1)";
         });
         setShow(time + time * 2, ".p1-nian", function (dom) {
             dom.style.opacity = 1;
             dom.style["-webkit-transform"] = "scale(1,1)";
         });

      }, 1000);
   <?php } ?>
});

function fixScroll(){
    let u = navigator.userAgent;
    let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if (isiOS) {
      window.scrollTo(0, 0);
    }
 }
$("input, select").blur(function(){
	fixScroll()
});
var _quyu='';
$(function(){
	$('.container, .bg').width(sWidth).height(h);
	$('.page, .p1-bg, .rule-t1').width(sWidth).height(_rate*1206);
	$('.thebg, .p-b').width(sWidth).height(_rate*1206);

	$('.p1-t1').width(_rate*296).height(_rate*268).css({"top":0, "right":0});
	$('.p1-t2').width(_rate*111).height(_rate*109).css({"top":_rate*82, "left":_rate*180});
	$('.p1-gui').width(_rate*160).height(_rate*152).css({"top":_rate*89, "left":_rate*336});
	$('.p1-guan').width(_rate*123).height(_rate*119).css({"top":_rate*244, "left":_rate*370});
	$('.p1-sao').width(_rate*118).height(_rate*131).css({"top":_rate*270, "left":_rate*254});
	$('.p1-nian').width(_rate*171).height(_rate*174).css({"top":_rate*354, "left":_rate*272});
	 
	$('.p1-bm').width(_rate*354).height(_rate*120).css({"top":_rate*8, "left":_rate*194});

	$('.p1-button').height(_rate*132).css({"top":_rate*850});
	 
	$('.qu-t1').width(sWidth).height(_rate*686).css({"top":_rate*280, "left":0});
	$('.qu-sh').width(_rate*450).height(_rate*113).css({"top":_rate*330, "left":_rate*150});
	$('.qu-sz').width(_rate*450).height(_rate*113).css({"top":_rate*460, "left":_rate*150});
	$('.qu-nt').width(_rate*450).height(_rate*113).css({"top":_rate*590, "left":_rate*150});
	$('.qu-jin').width(_rate*500).height(_rate*120).css({"top":_rate*805, "left":_rate*120});
	$('.p2-t1').width(sWidth).height(_rate*818).css({"top":_rate*262, "left":0});

	$("#p2-name").width(_rate*372).height(_rate*80).css({"top":_rate*300, "left":_rate*272});
	$("#p2-nianji").width(_rate*372).height(_rate*80).css({"top":_rate*420, "left":_rate*272});
	$("#p2-phone").width(_rate*372).height(_rate*80).css({"top":_rate*538, "left":_rate*272});
	$("#p2-code").width(_rate*196).height(_rate*80).css({"top":_rate*666, "left":_rate*272});
 
	$(".p2-jin").width(_rate*470).height(_rate*110).css({"top":_rate*930, "left":_rate*142});
	$('.p2-t2').width(sWidth).height(_rate*124).css({"top":_rate*640, "left":0});
	$('.p2-yz').width(_rate*154).height(_rate*47).css({"top":_rate*678, "left":_rate*484});

	$('.p2-send, .p2-ytxt').width(_rate*158).height(_rate*80);
	$('.p2-send').css({"top":_rate*666, "left":_rate*484});
	$('.p2-ytxt').css({"top":_rate*666, "left":_rate*484, 'line-height':_rate*80+'px'});

	$('.p3-t1').width(_rate*500).css({"top":_rate*466, "left":_rate*180});
	$('.p3-i1').height(_rate*56);
	$(".p3-t2").width(sWidth).height(_rate*838).css({"top":_rate*220, "left":0});
	$(".p3-quren").width(_rate*450).height(_rate*100).css({"top":_rate*910, "left":_rate*160});

	$(".p4-t1").width(sWidth).height(_rate*530).css({"top":_rate*318, "left":0});
	$(".p4-down").height(_rate*300).css({"top":_rate*488, "left":0});
	$(".p4-shi").width(_rate*106).height(_rate*68).css({"top":0, "left":_rate*212,'line-height':_rate*68+'px'});
	$(".p4-fen").width(_rate*106).height(_rate*68).css({"top":0, "left":_rate*342,'line-height':_rate*68+'px'});
	$(".p4-miao").width(_rate*106).height(_rate*68).css({"top":0, "left":_rate*456,'line-height':_rate*68+'px'});

	  
	function _runCD(theday){
	 
		$(".p4-down").countdown(theday, function(event) {
		   	 var _d=event.strftime('%D');
		   	 var _h=_htmp=event.strftime('%H');
		   	 var _fen=_fentmp=event.strftime('%M');
		   	 var _m=event.strftime('%S');
		   	 if(0 == _fen.substring(0,1) && 0 == _fen.substring(1)){
		   		$(".p4-shi").html(_h+' 时');
		   		$(".p4-fen").html(_fen+' 分');
		   		$(".p4-miao").html(_m+' 秒');
		   	 }else{
		   		$(".p4-shi").html(_h+' 时');
		   		$(".p4-fen").html(_fen+' 分');
		   		$(".p4-miao").html(_m+' 秒');
		   	 }
		});  

    }
	 
	function checkTel(tel){
	    return /^1(3|4|5|6|7|8|9)[0-9]\d{8}$/.test(tel)
	} 

	var _code='<?php echo $_SESSION['code'] ?>';
	console.log(_code);
	var _regi=30;
	var _cansendsms=true;
	function _countDown(){
		_regi--;
		if(_regi<1){
			$('.p2-ytxt').hide();
			$('.p2-yz').show();
			_cansendsms=true;
	        return;
	    }
	    $('.p2-ytxt').html(_regi+'秒');
	    window.setTimeout(function(){
	    	_countDown();
	        }, 1000);
	}
	$('.p2-send').click(function(){
		if(false == _cansendsms){return;}
		var _phone=$("#p2-phone").val();
		if('' == _phone){
			_popMsg("请输入手机号码");
			return;
	    }
		if(false == checkTel(_phone)){
			_popMsg("请输入正确的手机号");
			return;
	    }
		_regi=30;
		$('.p2-yz').hide();
		$('.p2-ytxt').show();
		_countDown();
		_cansendsms=false;
		$.post("./api/?c=sms", {phone:_phone}, function(data){}, "json");
	});
	
	

	if(h > _rate*1206){
		   var _cha= h - _rate*1246;
		   if(_cha > 0){
			  
			  $('.p1-bg').css({"top":_cha});
		      $('.kai, .t-wan, .t-rule').css({"top":_cha/2});
		      
		   }
    }

	function _popMsg(msg){
		$(".weui-msg").html(msg);
        $("#iosDialog2").show();
        return;
    }
	var _userNianJi='<?php echo $nianji ?>';
	$(".p2-jin").click(function(){
		 var _name=$("#p2-name").val();
		 var _nianji=$("#p2-nianji").val();
		 var _phone=$("#p2-phone").val();
		 var _thecode=$("#p2-code").val();
		 
         if('' == _name){
             $(".weui-msg").html("请填写学生姓名");
             $("#iosDialog2").show();
             return;
         }

         if('' == _nianji){
             $(".weui-msg").html("选择年级");
             $("#iosDialog2").show();
             return;
         }
         
         if('' == _phone){
             $(".weui-msg").html("请填写初赛预留的手机");
             $("#iosDialog2").show();
             return;
         }
         if(false == checkTel(_phone)){
 			$(".weui-msg").html("请填写正确的手机号");
            $("#iosDialog2").show();
            return;
         }
         if('nt' != _quyu){
        	 if('' == _thecode){
                 $(".weui-msg").html("请填写验证码");
                 $("#iosDialog2").show();
                 return;
             }
             if(_code != _thecode){
            	 $(".weui-msg").html("请填写正确的验证码");
                 $("#iosDialog2").show();
                 return;
             }
         }
         _userNianJi=_nianji;
         $.post("api/?c=bao", {name:_name, nianji:_nianji,phone:_phone, quyu:_quyu}, function(data){
		      console.log(data);
		      if('ok' == data.s){
    	    	  $(".p3-iname").html(_name);
                  $(".p3-iphone").html(_phone);
                  $(".p3-inj").html(_nianji);
                  $(".p3-iqu").html(data.u.q);
                  $(".p3-ixue").html(data.u.x);  
                  $(".p2").fadeOut();
                  $(".p3").fadeIn();
			  }else{
				  $(".weui-msg").html("未查询到您考试的信息");
		          $("#iosDialog2").show();
		          return;
			  }
 	     }, "json"); 
         
	});
	
	$(".p3-quren").click(function(){

		var begin = <?php echo strtotime(date("Y-m-j H:i:s")) ?>;
		if('三年级' == _userNianJi){
			var end = <?php echo strtotime('2019-11-10 9:00:00') ?>;
			var stop= <?php echo strtotime('2019-11-10 9:10:00') ?>;
			var _theday='2019/11/10 9:00:00';
	    }else if('四年级' == _userNianJi){
	    	var end = <?php echo strtotime('2019-11-10 9:30:00') ?>;
	    	var stop= <?php echo strtotime('2019-11-10 9:40:00') ?>;
	    	var _theday='2019/11/10 9:30:00';
		}else if('五年级' == _userNianJi){
	    	var end = <?php echo strtotime('2019-11-10 10:00:00') ?>;
	    	var stop= <?php echo strtotime('2019-11-10 10:10:00') ?>;
	    	var _theday='2019/11/10 10:00:00';
		}else{
			var end = <?php echo strtotime('2019-11-10 10:30:00') ?>;
			var stop= <?php echo strtotime('2019-11-10 10:40:00') ?>;
			var _theday='2019/11/10 10:30:00';
		}
        var span = end - begin;
        var isstop=begin - stop;
        <?php if (
            'oE4KPwXjHl-T9VeYSDMcspxX97kU' != $openid
            &&
            'bua' != $openid
            ){ ?>
        if(isstop > 1){
        	$(".weui-msg").html("您所在的年级考试已结束");
            $("#iosDialog2").show();
            return;
        }
        <?php } ?>
        if(span > 1){
        	_runCD(_theday);
        	$(".p3").fadeOut();
        	$(".p4").fadeIn();
        	return;
        }

		$.post("api/?c=getci", {id:1}, function(data){
            if('k' == data.s){
            	$(".weui-msg").html("您已参与答题");
		        $("#iosDialog2").show();
		        return;
            }else{
            	window.location.href="ti.php";
            }
	     }, "json"); 
		
		
	});

	$(".qu-sh, .qu-sz, .qu-nt").click(function(){
		_quyu=$(this).attr("data-id");
		console.log(_quyu);
		$(".qu-shb, .qu-szb, .qu-ntb").attr("src", "<?php echo $url; ?>img/3/red.png");
		if('sh' == _quyu){
			$(".qu-shb").attr("src", "<?php echo $url; ?>img/3/hui.png");
	    }else if('sz' == _quyu){
	    	$(".qu-szb").attr("src", "<?php echo $url; ?>img/3/hui.png");
		}else{
			$(".p2-t2, .p2-yz, .p2-send, #p2-code").hide();
			$(".qu-ntb").attr("src", "<?php echo $url; ?>img/3/hui.png");
	    }
	    
	}); 
	$(".qu-jin").click(function(){
		if('' == _quyu){
			$(".weui-msg").html("请选择您所在的区");
	        $("#iosDialog2").show();
	        return;
		}
		$(".qu").fadeOut(500);
		$(".p2").fadeIn(500);
	}); 

	$('.p1-bm').click(function(){
		$(".weui-msg").html("考试已结束");
        $("#iosDialog2").show();
        return;
 
		//$(".p1").fadeOut(500);
		//$(".qu").fadeIn(500);
	}); 
	$(".weui-btn").click(function(){
        $("#iosDialog2").hide();
	});

    
	if(!('placeholder' in document.createElement('input')) ){   
	    $('input[placeholder],textarea[placeholder]').each(function(){var that = $(this),text= that.attr('placeholder');   
	      if(that.val()===""){that.val(text).addClass('placeholder');}   
	      that.focus(function(){if(that.val()===text){that.val("").removeClass('placeholder');}})   
	      .blur(function(){if(that.val()===""){that.val(text).addClass('placeholder');}})   
	      .closest('form').submit(function(){   
	        if(that.val() === text){that.val('');}});});   
	 }

	if(h > _rate*1206){
		   var _cha= (h - _rate*1206)/2;
		   if(_cha > 0){
		      $('.thebg').css({"top":_cha});
		      $('.p1 .thebg').css({"top":_cha - 2});
		   }   
	}

 
});
</script>
</body>
</html>